﻿@model AllInOneModel
@using Nop.Plugin.Widgets.AllInOne;
@using Nop.Plugin.Widgets.AllInOne.Models;
@using Nop.Services.Events;
@using Nop.Core.Infrastructure;
@using Nop.Web.Framework;
@using Nop.Web.Framework.Events;

@Html.ValidationSummary(false)
@Html.HiddenFor(model => model.Id)


<div id="allinone-edit">
    <ul>
        <li @Html.RenderSelectedTabIndex(0, GetSelectedTabIndex())>
            @T("Plugins.Widgets.AllInOne.Info")
        </li>
        <li @Html.RenderSelectedTabIndex(1, GetSelectedTabIndex())>
            @T("Plugins.Widgets.AllInOne.CssScripts")
        </li>
    </ul>
    <div>
        @TabInfo()
    </div>
    <div>
        @TabCssScripts()
    </div>
</div>
<script>
    $(document).ready(function () {
        $("#allinone-edit").kendoTabStrip({
            animation: {
                open: {
                    effects: "fadeIn"
                }
            },
            select: tabstrip_on_tab_select
        });
    });
</script>

@{
    //custom tabs
    var eventMessage = new AdminTabStripCreated(this.Html, "allinone-edit");
    EngineContext.Current.Resolve<IEventPublisher>().Publish(eventMessage);
    foreach (var eventBlock in eventMessage.BlocksToRender)
    {
        @eventBlock
    }
}

@*save selected tab index*@
<input type="hidden" id="selected-tab-index" name="selected-tab-index" value="@(GetSelectedTabIndex())">


@helper TabInfo()
    { 
        <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.Name):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Name)
                @Html.ValidationMessageFor(model => model.Name)
            </td>
        </tr>
            <tr>
                <td class="adminTitle">
                    @Html.NopLabelFor(model => model.WidgetZone):
                </td>
                <td class="adminData">
                    @Html.EditorFor(model => model.WidgetZone)
                    @Html.ValidationMessageFor(model => model.WidgetZone)
                    &nbsp;&nbsp;<a href="http://www.nopcommerce.com/boards/t/25610/widgets-and-widgets-zones-in-310.aspx" target="_blank">Widget Zones List</a>
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    @Html.NopLabelFor(model => model.HtmlCode):
                </td>
                <td class="adminData">
                    <div style="padding:5px 0 3px 0;"><b>For HTML editor click: Tools - > Source Code</b></div>
                    @Html.EditorFor(model => model.HtmlCode, "RichEditor")
                    @Html.ValidationMessageFor(model => model.HtmlCode)
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    @Html.NopLabelFor(model => model.HtmlCodeExtra):
                </td>
                <td class="adminData">
                    <div style="padding:5px 0 3px 0;"><b>Additional code for the HTML code, used for tags that not supported by TinyMCE editor</b></div>
                    @Html.TextAreaFor(model => model.HtmlCodeExtra, new { style = "Width: 250px; Height: 150px;" })
                    @Html.ValidationMessageFor(model => model.HtmlCodeExtra)
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    @Html.NopLabelFor(model => model.Published):
                </td>
                <td class="adminData">
                    @Html.EditorFor(model => model.Published)
                    @Html.ValidationMessageFor(model => model.Published)
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    @Html.NopLabelFor(model => model.DisplayOrder):
                </td>
                <td class="adminData">
                    @Html.EditorFor(model => model.DisplayOrder)
                    @Html.ValidationMessageFor(model => model.DisplayOrder)
                </td>
            </tr>
    </table>
}

@helper TabCssScripts()
{
    <table class="adminContent">
     <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.jsFileList):
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.jsFileList)
                @Html.ValidationMessageFor(model => model.jsFileList) 
            </td>
            <td rowspan="2">
                 <ol>
                     <li><b>Upload files to Plugins\Widgets.AllInOne\Content\</b></li>
                     <li>Enter the file names separated by commas</li>
                     <li><b>JavaScript <span style="color:red;">WITH</span> extention:</b> example.js,example1.js,example2.js</li>
                     <li><b>CSS <span style="color:red;">WITHOUT</span>  extention:</b> CssExample,CssExample1,CssExample2</li>
                     <li>RTL support for css files: 
                        <ul>
                            <li>Upload both file - (style.css and style.rtl.css)</li>
                            <li>make sure the RTL file has the same name with a .rtl befor file extension (style.rtl.css)</li>
                        </ul>
                     </li>
                 </ol>

             </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.cssFileList):
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.cssFileList)
                @Html.ValidationMessageFor(model => model.cssFileList) 
            </td>
        </tr>
        </table>
}

